473,468 Members | 1,364 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Radio button selection in jsp

58 New Member
Hi All,

how to control the selection of radio buttons in jsp.
i think i have to write java script for that..
my code is like this
Expand|Select|Wrap|Line Numbers
  1. <form name="form1">
  2. <input type="radio" name="male">Male
  3. <input type="radio" name="female">Female
  4. <input type="submit" value="submit">
  5. </form>
  6.  
my problem is
if i select one radio button then i am not able to deselect it and
i am not able to select only one radio button.
how can i achieve it by using java script.

can anybody help me?
Jun 14 '07 #1
3 11234
JosAH
11,448 Recognized Expert MVP
Hi All,

how to control the selection of radio buttons in jsp.
i think i have to write java script for that..
my code is like this
Expand|Select|Wrap|Line Numbers
  1. <form name="form1">
  2. <input type="radio" name="male">Male
  3. <input type="radio" name="female">Female
  4. <input type="submit" value="submit">
  5. </form>
  6.  
my problem is
if i select one radio button then i am not able to deselect it and
i am not able to select only one radio button.
how can i achieve it by using java script.

can anybody help me?
I thought that default behaviour is that you can only deselect a radio button by
selecting another radio button. If I remember well you can preselect a radio
button using the "selected" flag in it's tag.

You don't need Javascript for that; simply make your JSP generate the
appropriate html and you're in bizniz ;-)

kind regards,

Jos
Jun 14 '07 #2
epots9
1,351 Recognized Expert Top Contributor
Hi All,

how to control the selection of radio buttons in jsp.
i think i have to write java script for that..
my code is like this
Expand|Select|Wrap|Line Numbers
  1. <form name="form1">
  2. <input type="radio" name="male">Male
  3. <input type="radio" name="female">Female
  4. <input type="submit" value="submit">
  5. </form>
  6.  
my problem is
if i select one radio button then i am not able to deselect it and
i am not able to select only one radio button.
how can i achieve it by using java script.

can anybody help me?
give them the same name:
[HTML]
<form name="form1">
<input type="radio" name="gender">Male
<input type="radio" name="gender">Female
<input type="submit" value="submit">
</form>
[/HTML]

good luck
Jun 14 '07 #3
shanmukhi
58 New Member
give them the same name:
[HTML]
<form name="form1">
<input type="radio" name="gender">Male
<input type="radio" name="gender">Female
<input type="submit" value="submit">
</form>
[/HTML]

good luck
it's working fine now..
thank u
Jun 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Matt | last post by:
I have radio buttons on a form, and when the user makes the selection, it will trigger the event and send the form to the web server and print the selected value. In Case 1, I just use submit...
1
by: Brian | last post by:
Hello all... I have a page that will be performing a search. The search consists of 3 radio button options. The first 2 will search the entire web through google and the site as indexed by...
2
by: jason | last post by:
The following (likely far from imperfect code), reports a value of NaN in the j4 display. I suppose the problem is I am not really passing the "checked" value of the radio button via .value ......
6
by: Craig Keightley | last post by:
I have a page that has n number of radio groups (yes/No) how can i prevent the form being submitted if more than one radio group is not selected? By default all radio groups are unchecked ...
2
by: Stoic | last post by:
I'm offering a selection of three items. One is $25, the second is $50, the third is $100. Along with selection one of the items I need to pass the quantity of the selection. Here is the code now....
1
by: Para | last post by:
Hi , I am working on a project using C/C++ in linux environment. Our program right now using the command line(console window) inputs and starts executing. command on console are to start...
3
by: Chris Marsh | last post by:
Hello, Is it possible w/ASP.Net to set the property of the radio button control to 'read-only' after the user has made their selection before hitting an 'submit' button? Think of a multiple...
2
by: dpazza | last post by:
Hi, I'm creating a quiz on using a form in VB 2005 express. I have four sets of questions and answers (labels and radio buttons) and I change between which set of questions is currently shown on...
10
by: mukeshrasm | last post by:
Hi I have a html in which there is two selection box and two radio button. Radio buttion is of array type. What I want if user will click the radio button then only he/she be able to make...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.